﻿using System;
using MYTech.Data;
using MYTech.Utils;

namespace MYTech.Formatter
{
    public class IPFormatter : IFormatProvider, ICustomFormatter
    {
        private IPFormatter()
        {
        }

        public object GetFormat(Type type)
        {
            return this;
        }

        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            return ConvertTo.NumberToIP(Convert.ToUInt32(arg));
        }

        public static IPFormatter GetInstance()
        {
            return new IPFormatter();
        }

        public static IPFormatter IP = GetInstance();
    }
}
